<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>异常处理</title>
</head>

<body>
    <script>
        function getSum(x, y) {
            if (!x || !y) {
                throw new Error('没有传递参数')
            }
            return x + y
        }

        getSum()
    </script>
</body>

</html>